#ifndef WEATHERWDIGET_H
#define WEATHERWDIGET_H
#include <QNetworkAccessManager>
#include <QWidget>

namespace Ui {
class WeatherWdiget;
}

class Day
{
public:

    QString date;
    QString week;

    QString type;
    QString ymd;

    int high;
    int low;

    QString fx;
    QString fl;

    int aqi;
};

class Today
{
public:
    QString date;
    QString city;

    QString ganmao;

    int wendu;
    QString shidu;
    int pm25;
    QString quality;

    QString type;

    QString fx;
    QString fl;

    int high;
    int low;
};

class WeatherWdiget : public QWidget
{
    Q_OBJECT

public:
    explicit WeatherWdiget(QWidget *parent = nullptr);
    ~WeatherWdiget();
private slots:
    void onReplied(QNetworkReply *reply);

private:
    Ui::WeatherWdiget *ui;
    QNetworkAccessManager *mNetworkAccessManager;
    void parseJson(QByteArray data);
    void getWeatherInfo(QString cityName);
    int parseString(QString str);

    //今天的数据
    Today mToday;
    //未来几天的数据
    Day mDay[6];
    QMap<QString, QString> mTypeMap;

};

#endif // WEATHERWDIGET_H
